﻿Public Class Station
    ' Position horizontale de la station
    Private _X As Integer
    Public Property X() As Integer
        Get
            Return _X
        End Get
        Set(ByVal Value As Integer)
            _X = Value
        End Set
    End Property

    ' Position verticale
    Private _Y As Integer
    Public Property Y() As Integer
        Get
            Return _Y
        End Get
        Set(ByVal Value As Integer)
            _Y = Value
        End Set
    End Property

    ' Nom de la station
    Private _Name As String
    Public Property Name() As String
        Get
            Return _Name
        End Get
        Set(ByVal Value As String)
            _Name = Value
        End Set
    End Property

    ' Constructeur
    Sub New(X As Integer, Y As Integer, Name As String)
        Me._X = X
        Me._Y = Y
        Me._Name = Name
    End Sub

    Public Function Intersects(P As Point) As Boolean
        ' Théorème de Pythagore afin de savoir si le point P se trouve dans le cercle représentant la station
        Return ((P.X - _X) * (P.X - _X) + (P.Y - _Y) * (P.Y - _Y)) <= 7 * 7
    End Function

    Public Overrides Function ToString() As String
        Return _Name
    End Function
End Class
